home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / Archives / GNU / GNUPLOTsrc.lha / term / epson.trm < prev    next >
Encoding:
Text File  |  1996-01-22  |  22.9 KB  |  917 lines

  1. /*
  2.  * $Id: epson.trm,v 1.6 1995/12/20 21:47:45 drd Exp $
  3.  *
  4.  */
  5.  
  6. /* GNUPLOT - epson.trm */
  7. /*
  8.  * Copyright (C) 1990 - 1993   
  9.  *
  10.  * Permission to use, copy, and distribute this software and its
  11.  * documentation for any purpose with or without fee is hereby granted, 
  12.  * provided that the above copyright notice appear in all copies and 
  13.  * that both that copyright notice and this permission notice appear 
  14.  * in supporting documentation.
  15.  *
  16.  * Permission to modify the software is granted, but not the right to
  17.  * distribute the modified code.  Modifications are to be distributed 
  18.  * as patches to released version.
  19.  *  
  20.  * This software  is provided "as is" without express or implied warranty.
  21.  * 
  22.  * This file is included by ../term.c.
  23.  *
  24.  * This terminal driver supports:
  25.  *  epson_lx800, nec_cp6, starc,
  26.  *  epson_60dpi, tandy_60dpi
  27.  *  epson_180dpi
  28.  *
  29.  * AUTHORS
  30.  *  Russell Lang
  31.  *  William Wilson
  32.  *
  33.  * send your comments or suggestions to (info-gnuplot@dartmouth.edu).
  34.  * 
  35.  */
  36.  
  37. /*
  38.  * adapted to the new terminal layout by Stefan Bodewig (1995)
  39.  */
  40.  
  41. #ifndef GOT_DRIVER_H
  42. #include "driver.h"
  43. #endif
  44.  
  45. #ifdef TERM_REGISTER
  46. #ifdef EPS180
  47. register_term(epson_180dpi)
  48. #endif /* EPS180 */
  49. #ifdef EPS60
  50. register_term(epson_60dpi)
  51. #endif /* EPS60 */
  52. #ifdef EPSONP
  53. register_term(epson_lx800)
  54. #endif /* EPSONP */
  55. #ifdef NEC
  56. register_term(nec_cp6)
  57. #endif /* NEC */
  58. #ifdef OKIDATA
  59. register_term(okidata)
  60. #endif /* OKIDATA */
  61. #ifdef STARC
  62. register_term(starc)
  63. #endif /* STARC */
  64. #ifdef TAMDY60
  65. register_term(tandy_60dpi)
  66. #endif /* TANDY60 */
  67. #endif /* TERM_REGISTER */
  68.  
  69. #ifdef TERM_PROTO
  70.  
  71. #if defined(EPS180) || defined(EPS60) || defined(EPSONP) || defined(TANDY60) || defined(OKIDATA)
  72. TERM_PUBLIC void EPSONinit __P((void));
  73. TERM_PUBLIC void EPSONreset __P((void));
  74. #define EPSONlinetype b_setlinetype
  75. #define EPSONmove b_move
  76. #define EPSONvector b_vector
  77. #define EPSONput_text b_put_text
  78. #define EPSON_text_angle b_text_angle
  79. #if defined(EPS60) || defined(EPSONP) || defined(TANDY60) || defined(OKIDATA)
  80.   #define EPSONVCHAR        FNT5X9_VCHAR      
  81.   #define EPSONHCHAR        FNT5X9_HCHAR        
  82.   #define EPSONVTIC        6
  83.   #define EPSONHTIC        6
  84.   #ifdef EPSONP
  85.     #define EPSONXMAX    512 
  86.     #define EPSONYMAX    384
  87.     TERM_PUBLIC void EPSONgraphics __P((void));
  88.     TERM_PUBLIC void EPSONtext __P((void));
  89.   #endif /* EPSONP */
  90. #endif /* four drivers */
  91. #endif /* all five */
  92.  
  93. #ifdef EPS180
  94. TERM_PUBLIC void EPS180graphics __P((void));
  95. TERM_PUBLIC void EPS180text __P((void));
  96. #define EPSON180VCHAR        FNT13X25_VCHAR
  97. #define EPSON180HCHAR        FNT13X25_HCHAR
  98. #define EPSON180VTIC        18
  99. #define EPSON180HTIC        18
  100. /* make the total dimensions 8 inches by 6 inches */
  101. #define EPS180XMAX    1260
  102. #define EPS180YMAX    1080
  103. #endif /* EPS180 */
  104.  
  105. #if defined(EPS60) || defined(TANDY60) || defined(OKIDATA)
  106. /* make the total dimensions 8 inches by 5 inches */
  107. #define EPS60XMAX    480
  108. #define EPS60YMAX    360
  109. TERM_PROTO void EPS60graphics __P((void));
  110. #ifdef TAMDY60
  111.   TERM_PROTO void TANDY60text __P((void));
  112. #endif /* TANDY60 */
  113. #ifdef OKIDATA
  114.   TERM_PROTO void OKIDATAtext __P((void));
  115. #endif /* OKIDATA */
  116. #ifdef EPS60
  117.   TERM_PROTO void EPS60text __P((void));
  118. #endif /* EPS60 */
  119. #endif /* all three */
  120.  
  121. #ifdef NEC
  122. TERM_PUBLIC void NECoptions __P((void));
  123. TERM_PUBLIC void NECinit __P((void));
  124. TERM_PUBLIC void NECgraphics __P((void));
  125. TERM_PUBLIC void NECtext __P((void));
  126. TERM_PUBLIC void NEClinetype __P((int linetype));
  127. TERM_PUBLIC void NECreset __P((void));
  128. #define NECmove b_move
  129. #define NECvector b_vector
  130. #define NECput_text b_put_text
  131. #define NEC_text_angle b_text_angle
  132. #define NECXMAX    400 
  133. #define NECYMAX    320
  134. #define NECVCHAR        FNT5X9_VCHAR      
  135. #define NECHCHAR        FNT5X9_HCHAR        
  136. #define NECVTIC        6
  137. #define NECHTIC        6
  138. #endif /* NEC */
  139.  
  140. #ifdef STARC
  141. TERM_PUBLIC void STARCinit __P((void));
  142. TERM_PUBLIC void STARCgraphics __P((void));
  143. TERM_PUBLIC void STARCtext __P((void));
  144. TERM_PUBLIC void STARClinetype __P((int linetype));
  145. TERM_PUBLIC void STARCreset __P((void));
  146. #define STARCmove b_move
  147. #define STARCvector b_vector
  148. #define STARCput_text b_put_text
  149. #define STARC_text_angle b_text_angle
  150. #define STARCXMAX    512 
  151. #define STARCYMAX    384
  152. #define STARCVCHAR        FNT5X9_VCHAR      
  153. #define STARCHCHAR        FNT5X9_HCHAR        
  154. #define STARCVTIC        6
  155. #define STARCHTIC        6
  156. #endif /* STARC */
  157.  
  158. #endif /* TERM_PROTO */
  159.  
  160. #ifndef TERM_PROTO_ONLY
  161. #ifdef TERM_BODY
  162.  
  163.  
  164. #ifdef EPSONP
  165.  
  166. /* The following epson lx800 driver uses generic bit mapped graphics
  167.    routines to build up a bit map in memory. */
  168. /* by Russell Lang, rjl@monu1.cc.monash.edu.au */
  169. /* On PC, print using 'copy file /b lpt1:', do NOT use 'print' */
  170. /* EPSON_init changes outfile to binary mode on PC's */
  171.  
  172. void epson_dump __P((void));
  173.  
  174. #define EPSONXLAST (EPSONXMAX - 1)
  175. #define EPSONYLAST (EPSONYMAX - 1)
  176.  
  177.  
  178. TERM_PROTO void EPSONinit()
  179. {
  180. #ifdef REOPEN_BINARY
  181.     reopen_binary();
  182. #endif
  183. }
  184.  
  185.  
  186. TERM_PROTO void EPSONgraphics()
  187. {
  188.     b_charsize(FNT5X9);
  189.     b_makebitmap((unsigned int)(EPSONXMAX*xsize),
  190.                  (unsigned int)(EPSONYMAX*ysize),1);
  191. }
  192.  
  193.  
  194. TERM_PROTO void EPSONtext()
  195. {
  196.     epson_dump();
  197.     b_freebitmap();
  198. }
  199.  
  200.  
  201. TERM_PROTO void EPSONreset()
  202. {
  203. #ifdef vms
  204.     fflush_binary();
  205. #endif
  206. }
  207.  
  208.  
  209. /* output file must be binary mode for epson_dump */
  210. void epson_dump()
  211. {
  212.   register unsigned int x;
  213.   int j;
  214.     for (j=(b_ysize/8)-1; j>=0; j--) {
  215.         /* select plotter graphics mode (square pixels) */
  216.         fprintf(outfile,"\033J\030");    /* line feed 8/72" = 8 dots */
  217.         fprintf(outfile,"\r\033*\005");
  218.         (void) fputc((char)(b_xsize%256),outfile);
  219.         (void) fputc((char)(b_xsize/256),outfile);
  220.         for (x=0; x<b_xsize; x++) {
  221.             (void) fputc( (char)(*((*b_p)[j]+x)), outfile );
  222.         }
  223.     }
  224. #ifdef PC
  225.     fprintf(stderr,"Print using: COPY /B\n");
  226. #endif
  227. }
  228.  
  229. #endif /* EPSONP */
  230.  
  231.  
  232. /* The following NEC CP6 Pinwriter driver uses generic bit mapped graphics
  233.    routines to build up a bit map in memory. */
  234. /* by Russell Lang, rjl@monu1.cc.monash.edu.au */
  235. /* On PC, print using 'copy file /b lpt1:', do NOT use 'print' */
  236. /* NECinit changes outfile to binary mode for PC's */
  237.  
  238. /* Add a Monochrome NEC printer (for faster speed and line types) jdc */
  239.  
  240. #ifdef NEC
  241.  
  242. void nec_dump __P((void));
  243. void nec_draft_dump __P((void));
  244.  
  245. #define NECXLAST (NECXMAX - 1)
  246. #define NECYLAST (NECYMAX - 1)
  247.  
  248.  
  249. /* plane 0=black, 1=cyan(blue), 2=magenta(red), 3=yellow */
  250. static unsigned int neccolor[] = {1,8,4,2,10,12,6,14};
  251. static unsigned int necpcolor[]= {0,2,1,4};
  252.  
  253. static int NECmode;
  254.  
  255. TERM_PROTO void NECoptions()
  256. {
  257.     if( END_OF_COMMAND ) {
  258.         strcpy(term_options,"monochrome");
  259.         NECmode='m';
  260.     } else
  261.     if( almost_equals(c_token,"m$onochrome") ) {
  262.         c_token++;
  263.         strcpy(term_options,"monochrome");
  264.         NECmode='m';
  265.     } else
  266.     if( almost_equals(c_token,"c$olor") ) {
  267.         c_token++;
  268.         strcpy(term_options,"color");
  269.         NECmode='c';
  270.     } else
  271.     if( almost_equals(c_token,"d$raft") ) {
  272.         c_token++;
  273.         strcpy(term_options,"draft");
  274.         NECmode='d';
  275.     } else {
  276.     /* error, but since the terminal is already set, default to mono */
  277.         strcpy(term_options,"monochrome");
  278.         NECmode='m';
  279.         int_error("modes: color, monochrome, draft",c_token);
  280.     }
  281. }
  282.  
  283. TERM_PROTO void NECinit()
  284. {
  285. #ifdef REOPEN_BINARY
  286.     reopen_binary();
  287. #endif
  288. }
  289.  
  290. TERM_PROTO void NECgraphics()
  291. {
  292.     b_charsize(FNT5X9);
  293.     b_makebitmap((unsigned int)(NECXMAX*xsize),
  294.              (unsigned int)(NECYMAX*ysize),(NECmode=='c' ? 4 : 1));
  295. }
  296.  
  297. TERM_PROTO void NECtext()
  298. {
  299.     if( NECmode=='d' ) {
  300.         nec_draft_dump();
  301.     } else {
  302.     nec_dump();
  303.     }
  304.     b_freebitmap();
  305. }
  306.  
  307. TERM_PROTO void NEClinetype(linetype)
  308. int linetype;
  309. {
  310.     if( NECmode=='c' ) {
  311.     if (linetype>=6)
  312.         linetype %= 6;
  313.     b_setvalue(neccolor[linetype+2]);
  314.     } else {
  315.         b_setlinetype(linetype);
  316.     }
  317. }
  318.  
  319.  
  320.     
  321. TERM_PROTO void NECreset()
  322. {
  323. #ifdef vms
  324.     fflush_binary();
  325. #endif
  326. }
  327.  
  328.  
  329. /* output file must be binary mode for nec_dump */
  330. void nec_dump()
  331. {
  332. unsigned int x;
  333. unsigned int plane,offset;
  334. int j;
  335. unsigned int column8;
  336. unsigned long column24;
  337. char column3, column2, column1;
  338.     fprintf(outfile,"\033P\033l\005");  /* 10cpi, left margin 5 char */
  339.     for (j=(b_ysize/8)-1;j>=0;j--) {
  340.             fprintf(outfile,"\033J\030");  /* 24/180" line feed */
  341.             for (plane=0; plane<b_planes; plane++) {
  342.                 offset=plane*b_psize;
  343.                 if (b_planes>1) {
  344.                     /* select colour for plane */
  345.                     fprintf(outfile,"\033r");
  346.                     (void) fputc((char)necpcolor[plane],outfile);
  347.                 }
  348.                 /* select plotter graphics mode (square pixels) */
  349.                 fprintf(outfile,"\r\033*\047");
  350.                 (void) fputc((char)((b_xsize*3)%256),outfile);
  351.                 (void) fputc((char)((b_xsize*3)/256),outfile);
  352.                 for (x=0; x<b_xsize; x++) {
  353.                     column8= (unsigned int)(*((*b_p)[j+offset]+x));
  354.                     column24=0;
  355.                     if (column8&0x01) column24|=(long)0x000007;
  356.                     if (column8&0x02) column24|=(long)0x000038;
  357.                     if (column8&0x04) column24|=(long)0x0001c0;
  358.                     if (column8&0x08) column24|=(long)0x000e00;
  359.                     if (column8&0x10) column24|=(long)0x007000;
  360.                     if (column8&0x20) column24|=(long)0x038000;
  361.                     if (column8&0x40) column24|=(long)0x1c0000;
  362.                     if (column8&0x80) column24|=(long)0xe00000;
  363.                     column1 = (char) ( column24      & (long)0xff);
  364.                     column2 = (char) ((column24>>8)  & (long)0xff);
  365.                     column3 = (char) ((column24>>16) & (long)0xff);
  366.                     (void) fputc(column3,outfile);
  367.                     (void) fputc(column2,outfile);
  368.                     (void) fputc(column1,outfile);
  369.                     (void) fputc(column3,outfile);
  370.                     (void) fputc(column2,outfile);
  371.                     (void) fputc(column1,outfile);
  372.                     (void) fputc(column3,outfile);
  373.                     (void) fputc(column2,outfile);
  374.                     (void) fputc(column1,outfile);
  375.                 }
  376.             }
  377.     }
  378.     fprintf(outfile,"\r\033l");
  379.     (void) fputc('\0',outfile);                /* set left margin to 0 */
  380.     if (b_planes > 1) {
  381.         fprintf(outfile,"\033r");
  382.         (void) fputc('\0',outfile);                /* set color to black */
  383.     }
  384. #ifdef PC
  385.     fprintf(stderr,"Print using: COPY /B\n");
  386. #endif
  387. #ifdef vms
  388.     fflush_binary();
  389. #endif
  390. }
  391.  
  392. /* output file must be binary mode for nec_dump */
  393. void nec_draft_dump()
  394. {
  395. unsigned int x;
  396. unsigned int plane,offset;
  397. int j;
  398.     fprintf(outfile,"\033P\033l\005\r");  /* 10cpi, left margin 5 char */
  399.     for (j=(b_ysize/8)-1;j>=0;j--) {
  400.             fprintf(outfile,"\033J\030");  /* 24/180" line feed */
  401.             for (plane=0; plane<b_planes; plane++) {
  402.                 offset=plane*b_psize;
  403.                 if (b_planes>1) {
  404.                     /* select colour for plane */
  405.                     fprintf(outfile,"\033r");
  406.                     (void) fputc((char)necpcolor[plane],outfile);
  407.                 }
  408.                 /* select plotter graphics mode (square pixels) */
  409.                 fprintf(outfile,"\r\033*");
  410.                 (void) fputc('\0',outfile);
  411.                 (void) fputc((char)(b_xsize%256),outfile);
  412.                 (void) fputc((char)(b_xsize/256),outfile);
  413.                 for (x=0; x<b_xsize; x++) {
  414.                     (void) fputc( (char)(*((*b_p)[j+offset]+x)), outfile );
  415.                 }
  416.             }
  417.     }
  418.     fprintf(outfile,"\r\033l");
  419.     (void) fputc('\0',outfile);                /* set left margin to 0 */
  420.     if (b_planes > 1) {
  421.         fprintf(outfile,"\033r");
  422.         (void) fputc('\0',outfile);                /* set color to black */
  423.     }
  424. #ifdef PC
  425.     fprintf(stderr,"Print using: COPY /B\n");
  426. #endif
  427. }
  428.  
  429. #endif /* NEC */
  430.  
  431. #ifdef STARC
  432. /* The following Star color driver uses generic bit mapped graphics
  433.    routines to build up a bit map in memory. */
  434. /* Star Color changes made by William Wilson, wew@naucse.cse.nau.edu */
  435. /* On PC, print using 'copy file /b lpt1:', do NOT use 'print' */
  436. /* STARC_init changes outfile to binary mode on PC's */
  437.  
  438. void STARC_dump __P((void));
  439.  
  440. #define STARCXLAST (STARCXMAX - 1)
  441. #define STARCYLAST (STARCYMAX - 1)
  442.  
  443.  
  444. /* plane 0=black, 1=cyan(blue), 2=magenta(red), 3=yellow */
  445. static unsigned int STARCcolor[] = {1,8,4,2,10,12,6,14};
  446. static unsigned int STARCpcolor[]= {0,2,1,4};
  447.  
  448. TERM_PROTO void STARCinit()
  449. {
  450. #ifdef REOPEN_BINARY
  451.     reopen_binary();
  452. #endif
  453. }
  454.  
  455.  
  456. TERM_PROTO void STARCgraphics()
  457. {
  458.     b_charsize(FNT5X9);
  459.     b_makebitmap((unsigned int)(STARCXMAX*xsize),
  460.                  (unsigned int)(STARCYMAX*ysize),4);
  461. }
  462.  
  463.  
  464. TERM_PROTO void STARCtext()
  465. {
  466.     STARC_dump();
  467.     b_freebitmap();
  468. }
  469.  
  470. TERM_PROTO void STARClinetype(linetype)
  471. int linetype;
  472. {
  473.     if (linetype>=6)
  474.         linetype %= 6;
  475.     b_setvalue(STARCcolor[linetype+2]);
  476. }
  477.  
  478.  
  479.  
  480. TERM_PROTO void STARCreset()
  481. {
  482. #ifdef vms
  483.     fflush_binary();
  484. #endif
  485. }
  486.  
  487.  
  488. /* output file must be binary mode for STARC_dump */
  489. void STARC_dump()
  490. {
  491. unsigned int x;
  492. unsigned int plane,offset;
  493. int j;
  494.     for (j=(b_ysize/8)-1;j>=0;j--) {
  495.         fprintf(outfile,"\033J\030");    /* line feed 8/72" = 8 dots */
  496.         for (plane=0; plane<b_planes; plane++) {
  497.             offset=plane*b_psize;
  498.             if (b_planes>1) {
  499.                 /* select colour for plane */
  500.                 fprintf(outfile,"\033r");
  501.                 (void) fputc((char)STARCpcolor[plane],outfile);
  502.             }
  503.             /* select plotter graphics mode (square pixels) */
  504.             fprintf(outfile,"\r\033*\005");
  505.             (void) fputc((char)(b_xsize%256),outfile);
  506.             (void) fputc((char)(b_xsize/256),outfile);
  507.             for (x=0; x<b_xsize; x++) {
  508.                 (void) fputc( (char)(*((*b_p)[j+offset]+x)), outfile );
  509.             }
  510.         }
  511.     }
  512.     if (b_planes > 1) {
  513.         fprintf(outfile,"\033r");
  514.         (void) fputc('\0',outfile);                /* set color to black */
  515.     }
  516. #ifdef PC
  517.     fprintf(stderr,"Print using: COPY /B\n");
  518. #endif
  519. }
  520.  
  521. #endif /* STARC */
  522.  
  523.  
  524. #ifdef EPS180
  525.  
  526. void eps180_dump __P((void));
  527.  
  528. #define EPS180XLAST (EPS180XMAX - 1)
  529. #define EPS180YLAST (EPS180YMAX - 1)
  530.  
  531. TERM_PROTO void EPS180graphics()
  532. {
  533.     b_charsize(FNT13X25);
  534.     b_makebitmap((unsigned int)(EPS180XMAX*xsize),
  535.                  (unsigned int)(EPS180YMAX*ysize),1);
  536. }
  537.  
  538.  
  539. TERM_PROTO void EPS180text()
  540. {
  541.     eps180_dump();
  542.     b_freebitmap();
  543. }
  544.  
  545.  
  546.  
  547. /* output file must be binary mode for eps180_dump */
  548. void eps180_dump()
  549. {
  550.   register unsigned int x;
  551.   int j;
  552.     fprintf(outfile,"\033@\033+\060\033l\005"); /* reset, set line spacing
  553.                                to 24/180", and
  554.                                move left margin */
  555.     for (j=(b_ysize/8)-1; j>=0; ) {
  556.         /* select printer graphics mode '39' */
  557.         fprintf(outfile,"\r\n\033*'");
  558.         (void) fputc((char)(b_xsize%256),outfile);
  559.         (void) fputc((char)(b_xsize/256),outfile);
  560.         for (x=0; x<b_xsize; x++) {
  561.                    (void) fputc( (char)(*((*b_p)[j]+x)), outfile );
  562.                  (void) fputc( (char)(*((*b_p)[j-1]+x)), outfile );
  563.                (void) fputc( (char)(*((*b_p)[j-2]+x)), outfile );
  564.         }
  565.     j -= 3;
  566.     }
  567.     fprintf(outfile,"\r\n\033@\r\n");     /* reset printer */
  568. #ifdef PC
  569.     fprintf(stderr,"Print using: COPY /B\n");
  570. #endif
  571. }
  572.  
  573. #endif /* EPS180 */
  574.  
  575. #ifdef EPS60
  576.  
  577. void eps60_dump __P((void));
  578.  
  579. #define EPS60XLAST (EPS60XMAX - 1)
  580. #define EPS60YLAST (EPS60YMAX - 1)
  581.  
  582. TERM_PROTO void EPS60graphics()
  583. {
  584.     b_charsize(FNT5X9);
  585.     b_makebitmap((unsigned int)(EPS60XMAX*xsize),
  586.                  (unsigned int)(EPS60YMAX*ysize),1);
  587. }
  588.  
  589.  
  590. TERM_PROTO void EPS60text()
  591. {
  592.     eps60_dump();
  593.     b_freebitmap();
  594. }
  595.  
  596.  
  597.  
  598. /* output file must be binary mode for eps60_dump */
  599. void eps60_dump()
  600. {
  601.   register unsigned int x;
  602.   int j;
  603.     fprintf(outfile,"\033%c\030",'3'); /* set line spacing 24/216" = 8 dots */
  604.     for (j=(b_ysize/8)-1; j>=0; j--) {
  605.         /* select printer graphics mode 'K' */
  606.         fprintf(outfile,"\r\n\033K");
  607.         (void) fputc((char)(b_xsize%256),outfile);
  608.         (void) fputc((char)(b_xsize/256),outfile);
  609.         for (x=0; x<b_xsize; x++) {
  610.             (void) fputc( (char)(*((*b_p)[j]+x)), outfile );
  611.         }
  612.     }
  613.     fprintf(outfile,"\033%c\044\r\n",'3'); /* set line spacing 36/216" = 1/6" */
  614. #ifdef PC
  615.     fprintf(stderr,"Print using: COPY /B\n");
  616. #endif
  617. }
  618.  
  619. #endif /* EPS60 */
  620.  
  621. #ifdef TANDY60
  622.  
  623. /* The only difference between TANDY60 and EPS60 is the inclusion
  624.    of codes to swap the Tandy printer into IBM mode and back
  625.    into Tandy mode.  For a Tandy already in IBM mode, use EPS60. */
  626.  
  627.  
  628. TERM_PROTO void TANDY60text()
  629. {
  630. #ifdef PC
  631.     fprintf(stderr, "Inserting Tandy/IBM mode conversion codes\n");
  632. #endif
  633.     /* Switch to IBM mode, and leave 3 inches above the plot so as
  634.        to get rough vertical centring on the page.  Perform the
  635.        centring by setting 1" line feeds and issuing 3 of them. */
  636.     fprintf(outfile, "\033!\033%c%c\n\n\n", '3',216);
  637.     eps60_dump();
  638.     b_freebitmap();
  639.     /* A form feed must be sent before switching back to Tandy mode,
  640.        or else the form setting will be messed up. */
  641.     fprintf(outfile, "\f\033!");
  642. }
  643.  
  644.  
  645. #endif  /* TANDY60 */
  646.  
  647. #ifdef OKIDATA
  648.  
  649. void okidata_dump __P((void));
  650.  
  651. TERM_PROTO void OKIDATAtext()
  652. {
  653.     okidata_dump();
  654.     b_freebitmap();
  655. }
  656.  
  657. int bitrev_tbl[] = {
  658. 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, 
  659. 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, 
  660. 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, 
  661. 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, 
  662. 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, 
  663. 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4, 
  664. 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, 
  665. 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc, 
  666. 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, 
  667. 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, 
  668. 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, 
  669. 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, 
  670. 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, 
  671. 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6, 
  672. 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, 
  673. 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe, 
  674. 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, 
  675. 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, 
  676. 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, 
  677. 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9, 
  678. 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, 
  679. 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5, 
  680. 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, 
  681. 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd, 
  682. 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, 
  683. 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3, 
  684. 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, 
  685. 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb, 
  686. 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, 
  687. 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, 
  688. 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, 
  689. 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff
  690. };
  691.  
  692. /* output file must be binary mode for okidata_dump */
  693. void okidata_dump()
  694. {
  695.   register unsigned int x;
  696.   int j;
  697.   char cur_char;
  698.   int  prev_char;
  699.  
  700.   prev_char = 0;
  701.     fprintf(outfile,"\033%c%c\020\033*eP:\003",'%','9'); /* set line spacing 16/144" = 8 dots :Turned on single density graphics mode*/
  702.     for (j=(b_ysize/8)-1; j>=0; j--) {
  703.         fprintf(outfile,"\003\016");
  704. /*        (void) fputc((char)(b_xsize%256),outfile); */
  705. /*        (void) fputc((char)(b_xsize/256),outfile); */
  706.         for (x=0; x<b_xsize; x++) {
  707.           if ( (cur_char = (char) 
  708.             (bitrev_tbl[ (int) (*((*b_p)[j]+x))])) == '\003') {
  709.             fprintf( outfile, "\003\003");
  710.           }
  711.           else {
  712.               (void) fputc( (char) cur_char , outfile);
  713.             }
  714.         }
  715.           }
  716.     fprintf(outfile,"\003\002\033%c%c\030\r\n",'%','9'); /* Turned off graphics mode: set line spacing 24/144" = 1/6"*/
  717. #ifdef PC
  718.     fprintf(stderr,"Print using: COPY /B\n");
  719. #endif
  720. }
  721.  
  722. #endif /* OKIDATA */
  723.  
  724. #endif /* TERM_BODY */
  725.  
  726. #ifdef TERM_TABLE 
  727.  
  728. #ifdef EPS180
  729. TERM_TABLE_START(epson180_driver)
  730.     "epson_180dpi", "Epson LQ-style 180-dot per inch (24 pin) printers",
  731.        EPS180XMAX, EPS180YMAX, EPSON180VCHAR, EPSON180HCHAR,
  732.        EPSON180VTIC, EPSON180HTIC, options_null, EPSONinit, EPSONreset,
  733.        EPS180text, null_scale, EPS180graphics, EPSONmove, EPSONvector,
  734.        EPSONlinetype, EPSONput_text, EPSON_text_angle,
  735.        null_justify_text, do_point, do_arrow, set_font_null
  736. TERM_TABLE_END(epson180_driver)
  737. #undef LAST_TERM
  738. #define LAST_TERM epson180_driver
  739. #endif /* EPS180 */
  740.  
  741. #ifdef EPS60
  742. TERM_TABLE_START(epson60_driver)
  743.     "epson_60dpi", "Epson-style 60-dot per inch printers",
  744.        EPS60XMAX, EPS60YMAX, EPSONVCHAR, EPSONHCHAR,
  745.        EPSONVTIC, EPSONHTIC, options_null, EPSONinit, EPSONreset,
  746.        EPS60text, null_scale, EPS60graphics, EPSONmove, EPSONvector,
  747.        EPSONlinetype, EPSONput_text, EPSON_text_angle,
  748.        null_justify_text, do_point, do_arrow, set_font_null
  749. TERM_TABLE_END(epson60_driver)
  750. #undef LAST_TERM
  751. #define LAST_TERM epson60_driver
  752. #endif /* EPS60 */
  753.  
  754. #ifdef EPSONP
  755. TERM_TABLE_START(epsonlx_driver)
  756.     "epson_lx800", "Epson LX-800, Star NL-10, NX-1000, PROPRINTER ...",
  757.        EPSONXMAX, EPSONYMAX, EPSONVCHAR, EPSONHCHAR, 
  758.        EPSONVTIC, EPSONHTIC, options_null, EPSONinit, EPSONreset, 
  759.        EPSONtext, null_scale, EPSONgraphics, EPSONmove, EPSONvector, 
  760.        EPSONlinetype, EPSONput_text, EPSON_text_angle, 
  761.        null_justify_text, line_and_point, do_arrow, set_font_null
  762. TERM_TABLE_END(epsonlx_driver)
  763. #undef LAST_TERM
  764. #define LAST_TERM epsonlx_driver
  765. #endif /* EPSONP */
  766.  
  767. #ifdef NEC
  768. TERM_TABLE_START(nec_driver)
  769.     "nec_cp6", "NEC printer CP6, Epson LQ-800 [monocrome color draft]",
  770.        NECXMAX, NECYMAX, NECVCHAR, NECHCHAR, 
  771.        NECVTIC, NECHTIC, NECoptions, NECinit, NECreset, 
  772.        NECtext, null_scale, NECgraphics, NECmove, NECvector, 
  773.        NEClinetype, NECput_text, NEC_text_angle, 
  774.        null_justify_text, line_and_point, do_arrow, set_font_null
  775. TERM_TABLE_END(nec_driver)
  776. #undef LAST_TERM
  777. #define LAST_TERM nec_driver
  778. #endif /* NEC */
  779.  
  780. #ifdef OKIDATA
  781. TERM_TABLE_START(okidata_driver)
  782.     "okidata", "OKIDATA 320/321 Standard",
  783.        EPS60XMAX, EPS60YMAX, EPSONVCHAR, EPSONHCHAR,
  784.        EPSONVTIC, EPSONHTIC, options_null, EPSONinit, EPSONreset,
  785.        OKIDATAtext, null_scale, EPS60graphics, EPSONmove, EPSONvector,
  786.        EPSONlinetype, EPSONput_text, EPSON_text_angle,
  787.        null_justify_text, do_point, do_arrow, set_font_null
  788. TERM_TABLE_END(okidata_driver)
  789. #undef LAST_TERM
  790. #define LAST_TERM okidata_driver
  791. #endif /* OKIDATA */
  792.  
  793. #ifdef STARC
  794. TERM_TABLE_START(starc_driver)
  795.     "starc", "Star Color Printer",
  796.        STARCXMAX, STARCYMAX, STARCVCHAR, STARCHCHAR, 
  797.        STARCVTIC, STARCHTIC, options_null, STARCinit, STARCreset, 
  798.        STARCtext, null_scale, STARCgraphics, STARCmove, STARCvector, 
  799.        STARClinetype, STARCput_text, STARC_text_angle, 
  800.        null_justify_text, line_and_point, do_arrow, set_font_null
  801. TERM_TABLE_END(starc_driver)
  802. #undef LAST_TERM
  803. #define LAST_TERM starc_driver
  804. #endif /* STARC */
  805.  
  806. #ifdef TANDY60
  807. TERM_TABLE_START(tandy60_driver)
  808.     "tandy_60dpi", "Tandy DMP-130 series 60-dot per inch graphics",
  809.        EPS60XMAX, EPS60YMAX, EPSONVCHAR, EPSONHCHAR,
  810.        EPSONVTIC, EPSONHTIC, options_null, EPSONinit, EPSONreset,
  811.        TANDY60text, null_scale, EPS60graphics, EPSONmove, EPSONvector,
  812.        EPSONlinetype, EPSONput_text, EPSON_text_angle,
  813.        null_justify_text, do_point, do_arrow, set_font_null
  814. TERM_TABLE_END(tandy60_driver)
  815. #undef LAST_TERM
  816. #define LAST_TERM tandy60_driver
  817. #endif /* TANDY60 */
  818.  
  819. #endif /* TERM_TABLE */
  820. #endif /* TERM_PROTO_ONLY */
  821.  
  822. #ifdef EPS180
  823. /*
  824.  * NAME: epson_180dpi
  825.  *
  826.  * OPTIONS: none
  827.  *
  828.  * SUPPORTS: Epson LQ-style 180-dot per inch (24 pin) printers
  829.  *
  830.  * Further Info: generic 24 pin writer driver. Nothing special. 
  831.  *
  832.  */
  833. #endif /* EPS180 */
  834.  
  835. #ifdef EPS60
  836. /*
  837.  * NAME: epson_60dpi
  838.  *
  839.  * OPTIONS: none
  840.  *
  841.  * SUPPORTS: Epson LQ-style 60-dot per inch (24 pin) printers
  842.  *
  843.  * Further Info: generic 24 pin writer driver with low resolution. 
  844.  *         Nothing special. 
  845.  *
  846.  */
  847. #endif /* EPS60 */
  848.  
  849. #ifdef EPSONP
  850. /*
  851.  * NAME: epson_lx800
  852.  *
  853.  * OPTIONS: none
  854.  *
  855.  * SUPPORTS: Epson LX-800, Star NL-10, NX-1000, PROPRINTER, ...
  856.  *
  857.  * Further Info: generic 9 pin writer driver. 
  858.  *
  859.  */
  860. #endif /* EPSONP */
  861.  
  862. #ifdef NEC
  863. /*
  864.  * NAME: nec_cp6
  865.  *
  866.  * OPTIONS: mode = (monochrom|colour|draft) default=monochrom
  867.  *
  868.  * SUPPORTS: NEC printer CP6, Epson LQ-800
  869.  *
  870.  * Further Info:  generic 24 pin writer driver. Nothing special.
  871.  *          Quite low resolution, too. 
  872.  *
  873.  */
  874. #endif /* NEC */
  875.  
  876. #ifdef OKIDATA
  877. /*
  878.  * NAME: okidata
  879.  *
  880.  * OPTIONS: none
  881.  *
  882.  * SUPPORTS: OKIDATA 320/321 Standard
  883.  *
  884.  * Further Info: 9 pin printer I suppose. Only difference to eps_60dpi
  885.  *         is the font.
  886.  *
  887.  */
  888. #endif /* OKIDATA */
  889.  
  890. #ifdef STARC
  891. /*
  892.  * NAME: starc
  893.  *
  894.  * OPTIONS: none
  895.  *
  896.  * SUPPORTS: Star Color Printer
  897.  *
  898.  * Further Info: Uses four colour planes (CMY). Don't even know how 
  899.  *         many pins.
  900.  *
  901.  */
  902. #endif /* STARC */
  903.  
  904. #ifdef TAMDY60
  905. /*
  906.  * NAME: tandy_60dpi
  907.  *
  908.  * OPTIONS: none
  909.  *
  910.  * SUPPORTS: Tandy DMP-130 series 60-dot per inch graphics
  911.  *
  912.  * Further Info: 9 pin printer I suppose. Only difference to eps_60dpi
  913.  *         is the font.
  914.  *
  915.  */
  916. #endif /* TANDY60 */
  917.